<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><c:if test="${customerid == 0 || customerid == null }">录入客户</c:if><c:if test="${customerid != null && customerid >0 }">客户详情</c:if></title>
<% request.setAttribute("menu", 1); %>
<%@ include file="/WEB-INF/page/public/contentmeta.jsp"%>
<link rel="stylesheet" href="<%=basePath%>css/global.css" media="all" />
<link rel="stylesheet" href="<%=basePath%>plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=basePath%>css/tab.css" media="all" />
<link rel="stylesheet" href="<%=basePath%>css/system.css?v=1" media="all">
<link rel="stylesheet" href="//at.alicdn.com/t/font_389729_ln4520tk0oo.css" media="all">
<%-- <script type="text/javascript" src="<%=basePath%>js/qualify/zizhisel.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jobsel/job.js"></script> --%>

<style type="text/css">
.enteringhide { display: block;}
.qymc p { display: block; border-bottom: 1px solid #cccccc; text-align: left;}

/* 增行弹窗 */
.addlxjl,.addyyjl,.addlxrtc,.addxqtc,.addwjtc { display:none; }
.tc_customercontactsdiv,.tc_customercategorydiv,.tc_customerfilediv { margin: 10px 0 0 0; }
.customtext {height: 30px; width: 265px; font-size: 16px; border: 1px solid #e6e6e6;}
.tc_customercategorydiv .customselect { height: 30px; width: 80px; font-size: 16px;}
.tc_btndiv { margin-top: 30px; text-align: center; }
.tc_btndiv .tc_savebtn { width: 100px; height: 40px; text-align: center; border: 0;
			background-color: #a48ad4; cursor: pointer; border-radius: 2px; font-size: 18px; color: rgb(255, 255, 255);}
.tc_customercategorydiv .categoryselect .layui-input-inline { width: 268px; }

/* 隐藏显示 */
.hideadd { display: none; }
.showadd { display: block; }

/* 必填前的红点 */
.layui-form-label {font-weight:bold }
.layui-form-label i { color:red; padding-right: 3px; }
.layui-form-label span {font-weight:bold }

  .highlight{background:yellow;color:red;}
        .zhititle{font-size:16px;color:#333;text-align:center;margin:30px 0 30px 0;}
        #btnSearch{width:60px;height:30px;margin:30px 0 30px 30px;}
        #txtKey{width:40%;height:30px;margin:30px 0 30px 30px;}
        #pretime div{margin-left:20px;margin-bottom:30px;}
        #pretime p{font-size:16px;color:#333;text-indent:33px;}
.site-table tbody tr td {
    text-align: left;
}

 		.hidden { display: none !important; }
 		.selectPickerWrapper *{box-sizing: border-box;}
 		.selectPickerWrapper{    position: relative;
    margin-top: 5px;
    display: inline-block;
    background-color: white;}
		.select-picker-search{width:300px;height:32px;line-height:32px;color:#666;border-radius:3px;border:1px solid #ddd;padding:0 10px;font-size:14px;cursor:pointer;}
		.select-picker-search-checked{position:relative;width:280px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;padding-right: 5px;}
		.select-picker-search-checked:after{
			border: 5px solid transparent; content: ' ';
		    height: 0; position: absolute;
		    width: 0; top:12.2px; border-top: 8px solid #666; right:0; }
		.select-picker-options-wrp{display:none;width:200px;border-radius: 2px;box-shadow: 0 1px 5px rgba(0,0,0,.2);background-color: #fff;position:absolute;top:36px;left:0;z-index:999;}
		.select-picker-options-serch input{width:160px;height:32px;line-height:32px;border:1px solid #ddd;border-radius:3px;margin:12px 0 0 10px;padding-left:8px;}
		.select-picker-options-serch input:focus{border-color: #66afe9;outline: 0; -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6)}
		.select-picker-options-list{width:100%;padding:8px 0;}
		.select-picker-options-list-item{width:100%;line-height:36px;cursor: pointer;padding:0 12px;}
		.select-picker-options-list-item:hover{background: #ebf1f5;}
		.duihao {display:inline-block;width:18px;height:18px;border-radius:3px;transform: translateY(4px);margin-right:6px;}
		.duihao-checked {  background:#00a0ff; position: relative; }
	    .duihao-checked:before, .duihao-checked::after {
	        content:""; height:10px; width:2px;
	        border-radius: 10px; display:block;
	        background:white; position: absolute;
	        top:4px;  left:10px; 
	        transform:rotate(45deg);-ms-transform:rotate(45deg);    
	    }
	    .duihao-checked::before {
	        height:6px; transform: rotate(-45deg); -ms-transform:rotate(-45deg);
	        position: absolute;  top:7px; left:5px;       
	    }
	    .duihao-nocheck{border:1px solid #ddd;}



</style>
</head>
<body>

<div class="admin-tab TM-tab admin-entering">
    <form class="layui-form" action="" id="enterform">
    <div class="layui-field-box entering-box">
    	<div class="entering">
            <h4>基本信息&nbsp;&nbsp;<button lay-submit="" lay-filter="save"class="layui-btn layui-btn-primary layui-btn-small" data="0">保存</button>
            	<button class="layui-btn layui-btn-primary layui-btn-small refreshbtn" type="button"><i class="layui-icon">&#x1002;</i>刷新</button>
            </h4>
            <table class="site-table table-hover" >
            <tr >
            <td style="padding-top: 10px;">
              <div class="layui-form-item">
                <label class="layui-form-label">资源类型 : </label>
                <div class="layui-input-block"  style="margin-left: 98px;" >  
                    <dic:cf type="3"   inputName="iszj"   name="customer_zj"  value="${cuinfo.iszj!=null?cuinfo.iszj:0}"    />
                </div>  
            </div>
            <div class="form-left" style="width: 33%;">
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>姓名 : </span> </label>
                <div class="layui-input-inline qymc">
                		<input type="text" name="cname" id="cname" value="${cuinfo.cname}"  autocomplete="off" class="layui-input">
                	<c:if test="${customerid != null && customerid > 0}">
                		<%-- <p>${cuinfo.cname}</p> --%>
                	</c:if>
                	<c:if test="${customerid == 0 || customerid == null }">
                	
                	</c:if>
                </div>
		<!-- <div class="layui-input-inline"   style="width: 30%;">
                     <a class="layui-btn layui-btn-primary layui-btn-small" id="namecxone" >信息查询</a>
                 </div> -->
            </div>
            <div class="layui-form-item">
         		<label class="layui-form-label"><i>*</i><span>联系电话 : </span></label>
             	<div class="layui-input-inline"  style="width: 35%;">
             		<input type="text" name="tel" id="tel" value='${ccon.tel}' autocomplete="off" class="layui-input">
             	
             	</div>
              <!-- <div class="layui-input-inline"  style="width: 5%;">
             		 	<i class="iconfont  icon-im_dianhua1"  id="callphone"   style="margin-left:1px;font-size: 20px; color: #1E9FFF;cursor:pointer;" ></i>
             	</div> -->
		      <div class="layui-input-inline"  style="width: 12%;">
             		  <a href="#" class="layui-btn layui-btn-primary layui-btn-small gsdcx"  >百度搜索</a> 
             	</div>
             	 <div class="layui-input-inline"  style="width: 12%;">
             		  <a href="#" class="layui-btn layui-btn-primary layui-btn-small sllgsdcx"  >360搜索</a> 
             	</div>
        	</div>
		<div class="layui-form-item">
                <label class="layui-form-label"><span>到期时间 : </span></label>
                <div class="layui-input-inline">
                    <input type="text" name="endtime" id="endtime" readonly="readonly"  value='${cuinfo.endtime.substring(0,10)}' placeholder="挂靠到期时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
                </div>
                 <div class="layui-input-inline">
                 <input type="text" name="endtimeone" id="endtimeone" readonly="readonly"  value='${cuinfo.endtime.substring(0,10)}' placeholder="B证到期时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
                 </div>
                  <div class="layui-input-inline">
                  <input type="text" name="endtimetwo" id="endtimetwo" readonly="readonly"  value='${cuinfo.endtime.substring(0,10)}' placeholder="继续教育时间" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
                </div>
            </div>
        	<div class="layui-form-item">
            	<label class="layui-form-label"><i>*</i><span>证书专业 : </span></label>
                <div class="layui-input-inline"  style="width: 60%;">
                	<input type="text" name="technicalpost" id="technicalpost" value="${cuinfo.technicalpost}" autocomplete="off" class="layui-input">
                </div>
                  <a href="#" class="layui-btn layui-btn-primary layui-btn-small zgzcx"  >查资格证</a> 
           	</div>
           
        	<%-- <c:if test="${customerid == 0 || customerid == null }">
	            <div class="layui-form-item">
	                <label class="layui-form-label"><i>*</i><span>拥有证书 : </span></label>
	                <div class="layui-input-inline" style="width: 50%;">
	                	<input name="category" id="category" type="hidden" value='${ccat.category}'>
	                	<input type="text" name="zizhiType1" id="zizhiType1" class="layui-input">
	                </div>
	            </div>
            </c:if> --%>
            <div class="layui-form-item address">
                <label class="layui-form-label"><span>地址 :</span></label>
                <div class="layui-input-inline"  style="width: 50%;">
                	 <input type="text" name="address"  id="address"  value="${cuinfo.address}"  autocomplete="off" class="layui-input">
                    <%-- <select name="province" id="province"  lay-filter="province" class="provinceclass" >
                        <option value="-1" selected>请选择省</option>
                        <c:forEach var="prov" items="${province}" varStatus="p1">
                        	<option value="${prov.id}"  <c:if test="${cuinfo.province==prov.id}">selected</c:if>>${prov.provincename}</option>
                        </c:forEach>
                    </select> --%>
                </div>
 		
               <%--  <div class="layui-input-inline">
                    <select name="city" id="city"  lay-filter="city" value="${cuinfo.city}">
                    	<option value="">请选择市</option>
                    </select>
                </div> --%>
            </div>
        <div class="layui-form-item">
            	<label class="layui-form-label"><i>*</i>身份证号 : </label>
                <div class="layui-input-inline"   style="width: 30%;">
                	<input type="text" name="idcard" id="idcard" value="${cuinfo.idcard}" autocomplete="off" class="layui-input">
                </div>
                <!--  <div class="layui-input-inline"   style="width: 15%;">
                     <a class="layui-btn layui-btn-primary layui-btn-small" id="ancha" >安徽证书查询</a>
                 </div>
                 <div class="layui-input-inline"   style="width: 15%;">
                     <a class="layui-btn layui-btn-primary layui-btn-small" id="zsxxcxone" >证书信息查询</a>
                 </div>
                 <div class="layui-input-inline"   style="width: 12%;">
                     <a class="layui-btn layui-btn-primary layui-btn-small" id="bzcxone" >B证查询</a>
                 </div> -->
            </div>

        	<div class="layui-form-item">
        		<label class="layui-form-label">人才帐号 : </label>
        		<div class="layui-input-inline qymc">
	         	 	<input type="text" name="account" id="account"   value="${cuinfo.account}" autocomplete="off" class="layui-input">
               	</div>
             	<%-- <div class="layui-input-inline">
             		<input type="text" name="account" id="account" value="${cuinfo.account}" autocomplete="off" class="layui-input">
             	</div> --%>
        	</div>
        	<div class="layui-form-item">
         		<label class="layui-form-label">聘用密码 : </label>
         		<div class="layui-input-inline ">
	         		<input type="text" name="passwordtwo" id="passwordtwo"   value="${cuinfo.passwordtwo}"   autocomplete="off" class="layui-input">
	            </div>
	            	<label class="layui-form-label">后台密码 : </label>
             	  <div class="layui-input-inline">
             	   				<input type="text" name="password" id="password"    value="${cuinfo.password}"   autocomplete="off" class="layui-input">
             	  </div>  
        	</div>
        </div>
        <div class="form-right" style="width: 40%;">
        	<div class="layui-form-item">
                <label class="layui-form-label"><i></i><span>备用名 : </span> </label>
                <div class="layui-input-inline qymc">
                	<input type="text" name="nickname" id="nickname" value="${cuinfo.nickname}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item ">
                <label class="layui-form-label"><i>*</i><span> 录入时间 : </span></label>
                <div class="layui-input-inline qymc">
	                <c:if test="${customerid != null && customerid > 0}">
	                	<p>${cuinfo.createdate.substring(0,10)}</p>
	                </c:if>
	                <c:if test="${customerid == 0 || customerid == null }">
	                    	<input type="text" name="createdate" id="createdate" value='${fn:length(ccat.createdate)>0 ? ccat.createdate.substring(0,10) : ""}' placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
	                </c:if>
                </div>
            </div>
             
          <%--   <c:if test="${customerid == 0 || customerid == null }">
	           	<div class="layui-form-item">
	            	<label class="layui-form-label">挂证类型 : </label>
	                <div class="layui-input-inline">
	                    <select name="types" id="types">
	                    	<option value="3" <c:if test="${cuinfo.types == 3}">selected</c:if> >不限</option>
	                        <option value="1" <c:if test="${cuinfo.types == 1}">selected</c:if> >初始</option>
	                        <option value="2" <c:if test="${cuinfo.types == 2}">selected</c:if> >转注册</option>
	                    </select>
	                </div>
	           	</div>
           	</c:if> --%>
            <div class="layui-form-item warehouse">
                <label class="layui-form-label">成熟等级 : </label>
                <div class="layui-input-inline">
                
                    <select name="state" id="state">
                    	<c:if test="${cuinfo.state==4 || state == 4}">  <option value="4"  selected >公共资源</option></c:if>
                        <c:if test="${cuinfo.state!=4}">
                           <option value="0" <c:if test="${cuinfo.state==0 || state == 0}">selected</c:if>>最新资源</option> 
                           <option value="1" <c:if test="${cuinfo.state==1 || state == 1}">selected</c:if>>意向不明</option> 
                          <option value="2" <c:if test="${cuinfo.state==2 || state == 2}">selected</c:if>>意向明确</option>
                          <option value="3" <c:if test="${cuinfo.state==3 || state == 3}">selected</c:if>>意向强烈</option>
                          <option value="7" <c:if test="${cuinfo.state==7 || state == 7}">selected</c:if>>合作客户</option> 
                        </c:if> 
                    </select>
                </div>
            </div>
           
           <div class="layui-form-item warehouse">
	            <label class="layui-form-label">客户来源 : </label>
	            <div class="layui-input-inline">
	                   <select name="source" id="source">
	                       <option value="0">客户来源</option>
	                       <dic:cf type="2" name="customer_source" value="${cuinfo.source}"/>
	                   </select>
	             </div>
             </div>
             <div class="layui-form-item warehouse">
            	<label class="layui-form-label ">客户分类 : </label>
                <div class="layui-input-inline">
                    <select name="level" id="level">
                    	<option value="0" <c:if test="${cuinfo.level == null || cuinfo.level < 1}">selected</c:if>  >客户分类</option>
                    	<option value="1" <c:if test="${cuinfo.level == 1}">selected</c:if> >小客户</option>
                    	<option value="2" <c:if test="${cuinfo.level == 2}">selected</c:if> >普通客户</option>
                    	<option value="3" <c:if test="${cuinfo.level == 3}">selected</c:if> >重点客户</option>
                    	<option value="4" <c:if test="${cuinfo.level == 4}">selected</c:if> >优质客户</option>
                    </select>
                </div>
            </div>
  	    <div class="layui-form-item">
	            <label class="layui-form-label">QQ : </label>
	            <div class="layui-input-inline">
	            	<input type="text" name="qq" id="qq" value='${ccon.qq}' autocomplete="off" class="layui-input">
	            </div>
           	</div>
           	 <div class="layui-form-item">
         		<label class="layui-form-label"><i>*</i>微信 : </label>
             	<div class="layui-input-inline">
             		<input type="text" name="webchart" id="webchart" value="${ccon.webchart}" autocomplete="off" class="layui-input">
             	</div>
             </div>
             <c:if test="${customerid != null && customerid > 0}">
              <div class="layui-form-item">
         		<label class="layui-form-label ">挂靠企业 : </label>
             	<div class="layui-input-inline" style="width: 40%;">
             		<input type="text" readonly="readonly"  value="${cuinfo.gaokaoQY.cname}" autocomplete="off" class="layui-input">
             	</div>
             	<c:if test="${cuinfo.gaokaoQY!=null&&cuinfo.gaokaoQY.id!=null}">
             		<a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-small jpbtn" data="${cuinfo.gaokaoQY.quid}" >退出</a> 
             	</c:if>
             	<c:if test="${cuinfo.gaokaoQY==null||cuinfo.gaokaoQY.id==null}">
             	 	<a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-small tjrybtn" >选择企业</a> 
             	</c:if> 
             </div>
             </c:if>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline TM-textarea-block"  style="width: 60%;">
                <textarea placeholder="请输入内容" class="layui-textarea" id="summary" name="summary">${cuinfo.summary}</textarea>
            </div>
        </div>
         <div class="layui-form-item layui-form-text">
         
	            <label class="layui-form-label">协作人</label>
 		     	<div class="layui-input-inline"  style="width: 50%;position:relative;">  
             		<!--   <a href="#" class="layui-btn layui-btn-primary layui-btn-small gathering" >添加协作人</a>  -->
             	   <input name="xzuser" id="xzuser" value="${cuinfo.xzuser}" type="hidden">
             	   <div id="demo1" class="selectPickerWrapper">
				        <select  lay-ignore class="hidden" multiple="multiple">
				           <c:forEach var="nameobj" items="${userlist}">
                    		<option value="${nameobj.uid}" <c:if test="${ nameobj.uid == pager.params.uid }">selected</c:if> >${nameobj.name}</option>
                    	  </c:forEach>
				        </select>
				    </div>
             	 </div> 
         </div>
        <div class="layui-form-item TM-save-item">
            <div class="layui-input-block">
            	<input type="hidden" value="${customerid}" id="id" name="id" >
            	<input type="hidden" value="${type}" id="type" name="type">
            	<input type="hidden" value="${state}" id="states" name="states">
            </div>
        </div>
        </td></tr></table></div></div>
        
    </form> 
    
     <div class="entering   hideadd  <c:if test='${customerid != null && customerid > 0 && cuinfo.state!=4  }'> showadd </c:if>">
            <h4>需求&nbsp;&nbsp;<button class="layui-btn layui-btn-primary layui-btn-small addxq" data="2">+添加需求</button></h4>
            <form  class="layui-form" action="" method="post" id="savecustomercategoryform">
                <table class="site-table table-hover TM-table3">
	                <thead>
		                <tr>
		                    <th style="width:15%;">证件类型</th>
		                    <th style="width:5%;">证件数量</th>
		                    <th style="width:10%;">性质</th>
		                    <th style="width:10%;">用途</th>
		                    <th style="width:30%;">备注</th>
		                    <th style="width:20%;">操作</th>
		                </tr>
	                </thead>
                    <tbody class="tb_customercategory">
                    	<c:forEach var="catobj" items="${cuinfo.categoryItem}" varStatus="cat"> 
		                	<tr class="catetr${catobj.id}" data="${catobj.id}">
			                	<td><c:if test="${catobj.buystate==0}"><i class="iconfont icon-maichu " style="color:red;font-size: 19px;"></i></c:if><c:if test="${catobj.buystate==1}"><i class="iconfont icon-mairu " style="color:#00e200;font-size: 19px;"></i></c:if>&nbsp; ${catobj.categoryname}</td>
			                	<td>${catobj.count}本</td>
			                	<td>
				                	<c:if test="${catobj.types == 1}">
				                		初始
				                	</c:if>
				                	<c:if test="${catobj.types == 2}">
				                		转注
				                	</c:if>
				                	<c:if test="${catobj.types == 3}">
				                		初转不限
				                	</c:if>
				                	<c:if test="${catobj.types == 4}">
				                		资质
				                	</c:if>
			                	</td>
			                	<td>
			                		<c:if test="${catobj.paperspurpose == 1}">
			                			入库
			                		</c:if>
			                		<c:if test="${catobj.paperspurpose == 2}">
			                			项目
			                		</c:if>
			                		<c:if test="${catobj.paperspurpose == 3}">
			                			动态核查
			                		</c:if>
			                		<c:if test="${catobj.paperspurpose == 0}">
			                			其他
			                		</c:if>
			                	</td>
			                	<td>${catobj.remark}</td>
			                	<td>
			                		<!-- <button class='layui-btn layui-btn-primary layui-btn-small updatecustomercategory' type='button'>修改<i class='layui-icon'></i></button> -->
			                		<button class='layui-btn layui-btn-primary layui-btn-small deletecategory' type='button'>删除<i class='layui-icon'></i></button>
			                	</td>
		                	</tr>
		                </c:forEach>
                    </tbody>
                </table>
            </form>
        </div> 
    
	<!-- 这里现在用showadd和hideadd控制 -->
	<div class="layui-field-box entering-box hideadd <c:if test='${customerid != null && customerid > 0 }'> showadd </c:if>">
		<div class="entering">
            <h4>联系记录 <button class="layui-btn layui-btn-primary layui-btn-small lxjladd" data="4">+添加联系记录</button> <a class="layui-btn layui-btn-primary layui-btn-small" id="zsxxcx" >证书信息查询</a></h4>
            <table class="site-table table-hover TM-table3">
                <thead> 
                <tr>
                	<th style="width:18%;">跟进人</th>
                    <th style="width:18%">跟进时间</th>
                    <th style="width:64%">跟进内容</th>
                </tr>
                </thead>
                <tbody class="tb_customercontacts lxjlbody">
                <c:forEach var="lxobj" items="${lxpager.resultList}" varStatus="lx">
                		<tr>
                			<td>${lxobj.uname}</td>
	                		<td>${lxobj.updatedate.substring(0,10)} ${lxobj.updatedate.substring(10,16)}</td>
	                		<td>${lxobj.remark}</td>
                		</tr>
                	</c:forEach>
                </tbody>
                	 <tfoot <c:if test="${lxpager.totalPages<2}"> style="display:none"</c:if>>
	                  <tr>
	                  <td colspan="4">
		                   <div class="admin-table-page">
				   				<div id="page" class="page"></div>
							</div> 
					   </td>
	                   </tr>
	                </tfoot> 
               
               
            </table>
            <input type="hidden" name="linetype" id="linetype1" value="1">
        </div>
        
        <div class="entering">
            <h4>预约记录 <button class="layui-btn layui-btn-primary layui-btn-small yyjladd" data="5">+添加预约</button></h4>
            <table class="site-table table-hover TM-table3">
                <thead>
                <tr>
                    <th style="width:145px;">预约时间</th>
                    <th style="width:145px;">预约人</th>
                    <th style="width:145px;">备注</th>
                </tr>
                </thead>
                <tbody class="tb_customercontacts">
                	<c:forEach var="yyobj" items="${yypager.resultList}" varStatus="yy">
                		<tr>
	                		<td>${yyobj.stime.substring(0,10)} ${yyobj.stime.substring(10,16)}</td>
	                		<td>${yyobj.uname}</td>
	                		<td>${yyobj.remark}</td>
                		</tr>
                	</c:forEach>
                </tbody>
            </table>
            <input type="hidden" name="linetype" id="linetype1" value="1">
        </div>
        <div class="entering">
            <h4>相关附件(共 <i>${fn:length(cuinfo.filesItem)}</i> 条) <button class="layui-btn layui-btn-primary layui-btn-small addwj" data="3">+增加文件</button></h4>
            <form action="" method="post" enctype="multipart/form-data" id="customerfileform">
            <table class="site-table table-hover TM-table3">
                <thead>
                <tr>
                    <th style="width:50px;">序号</th>
                    <th style="width:160px;">文件名</th>
                    <th style="width:160px;">文件类别</th>
                    <th style="width:130px;">文件大小</th>
                    <th style="width:120px;">备注</th>
                    <th style="width:140px;">操作</th>
                </tr>
                </thead>
                <tbody class="tb_customerfile">
                <c:forEach var="fileobj" items="${cuinfo.filesItem}" varStatus="file">
                	<tr class="filetr${fileobj.id}" data="${fileobj.id}">
	                    <td>${file.index+1}</td>
	                    <td>${fileobj.filesinfo.name}</td>
	                    <td>${fileobj.type==1?'原件':'扫描件'}</td>
	                    <td>${fileobj.filesinfo.filesize}kb</td>
	                    <td class="fielremark">${fileobj.remark}</td>
	                    <td>
	                    	 <c:if test="${fileobj.updateState==1}">
	                    	 <button class="layui-btn layui-btn-primary layui-btn-small detelecustomerfilebtn" type='button' data="${fileobj.id}">删除<i class="layui-icon "></i></button>
	                    	 </c:if>
	                    	<button class="layui-btn layui-btn-primary layui-btn-small downloadcunstomerfilesbtn" type='button' data="${fileobj.filesinfo.id}">下载<i class="layui-icon"></i></button>
	                    		<c:if test="${fileobj.filesinfo.suffix=='png'||fileobj.filesinfo.suffix=='jpg'||fileobj.filesinfo.suffix=='gif'}">
	                   
	                    <button class="layui-btn layui-btn-primary layui-btn-small downloadcunstomerfilesbtntwo" type='button' data="${fileobj.filesinfo.id}">预览<i class="layui-icon"></i></button>
	                    </c:if>
	                    	
	                    </td>
                	</tr>
                </c:forEach>
                </tbody>
            </table>
            </form>
        </div>
    </div>
    
     <!-- 需求弹窗 -->
     <div class="addxqtc">
   		<form action="" id="tc_savecustomercategoryform"  class="layui-form" >
   			<div class="tc_customercategorydiv"style="padding-top:10px;">
	   			<div class="layui-form-item">
	   				<label class="layui-form-label"><i>*</i><span>证书类型 : </span></label>
	   				<div class="layui-input-inline" style="width:80%">
	            		<input name="category" id="category" type="hidden" value="" >
	                   	<input type="hidden" name="zizhiType" id="zizhiType" class="layui-input"     autocomplete="off"     placeholder="请选择证件类型">
	                  	<input type="text" name="categoryname"  id="categoryname" class="layui-input"     placeholder="请输入证件类型">
	                </div>
	   			</div>
	   			<div class="layui-form-item">
    				<label class="layui-form-label"><i>*</i>供求关系 : </label>
    				<div class="layui-input-inline"  style="width:70%">
    					 <input type="radio" name="buystate" value="1"   title="买"  lay-filter="filter" lay-skin="primary" > 
					    <input type="radio" name="buystate" value="0"  checked="checked"   title="卖" lay-filter="filter" lay-skin="primary">  
	                </div>
    			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>数量 : </span></label>
	                   <div class="layui-input-inline" style="width:80%">
							<input name="count" id="count" type="text" value="1"  class="layui-input" placeholder="请输入证书数量">
	                   </div>
	   			</div>
	   			<!-- <div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>结束时间 : </span></label>
	                   <div class="layui-input-inline" style="width:80%">
							<input type="text" name="endtime" id="endtime"  class="layui-input" placeholder="请选择结束时间:yyyy-mm-dd" autocomplete="off"  onclick="layui.laydate({elem: this})">
	                   </div>
	   			</div> -->
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>性质 : </span></label>
					<div class="layui-input-inline" style="width:80%">
						<select name="types" id="types" class="layui-input layui-unselect">
							<option value="1">初始</option>
							<option value="2">转注</option>
							<option value="3">初转不限</option>
							<option value="4">资质</option>
                       </select>
					</div>
	   			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label"><i>*</i><span>用途 : </span></label>
                   <div class="layui-input-inline" style="width:80%">
                       <select name="paperspurpose" id="paperspurpose" class="layui-input layui-unselect">
                           <option value="1">入库</option>
                           <option value="2">项目</option>
                            <!-- <option value="3" >动态核查</option>
                            <option value="0" >其他</option> -->
                       </select>
                   </div>
	   			</div>
	   			<div class="layui-form-item categoryselect">
	   				<label class="layui-form-label">备注 : </label>
	   				<div class="layui-input-inline" style="width:80%">
	   					<textarea placeholder="请输入备注内容" name="remark" id="xqremark" class="layui-textarea"></textarea>
						<input type="hidden" id="cusid" name="cusid" value="${customerid}">
					</div>
	   			</div>
	   			<div class="layui-form-item tc_btndiv">
	   				<input type="hidden" value="" id="categoryid" name="id">
	            </div>
            </div>
   		</form>
		
		
   
 </div>
    
    <!-- 文件弹窗 -->
    <div class="addwjtc">
    	<div class="tc_customerfilediv">
    		<form class="layui-form" action="" method="post" id="tc_customerfileform" enctype="multipart/form-data">
	<div class="layui-form-item">
    				<label class="layui-form-label">选择类别 : </label>
    				<div class="layui-input-inline" style="width:70%">
    				 <input type="radio" name="filetype" value="1" title="扫描件（原件在公司）" lay-skin="primary">
     				 <input type="radio" name="filetype" value="2" title="扫描件" checked lay-skin="primary">
    				
    					<!-- <select name="filetype" id="type" class="layui-input layui-unselect">
	                        <option value="1">扫描件（原件在公司）</option>
	                        <option value="2">扫描件</option>
	                	</select> -->
    				</div>
    			</div>
    			<div class="layui-form-item">
    				<label class="layui-form-label"><i>*</i>文件内容 : </label>
    				<div class="layui-input-inline" id="others" style="width:70%">
    				    <input type="radio" name="remarks" value="转账截图" title="转账截图" lay-filter="filter" lay-skin="primary" > 
    					 <input type="radio" name="remarks" value="资格证" title="资格证" lay-filter="filter" lay-skin="primary" > 
					    <input type="radio" name="remarks" value="注册证" title="注册证" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="注册章" title="注册章" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="注册材料" title="注册材料" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="合同" title="合同" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="身份证" title="身份证" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="毕业证" title="毕业证" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="职称证" title="职称证" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="职称材料" title="职称材料" lay-filter="filter" lay-skin="primary"> 
					    <input type="radio" name="remarks" value="其他" title="其他"    lay-filter="filter" lay-skin="primary"> 
					    <input type="text" name="otherremarks" id="otherremarks" value="" style="display:none;width:200px;" autocomplete="off" class="layui-input" placeholder="请描述文件内容 "> 
    				
	                	<input type="text" name="remark" id="fsremarks"  value="" style="display:none"  class="layui-input">
	                </div>
    			</div>

    			<div class="layui-form-item">
    				<label class="layui-form-label">选择文件 : </label>
    				<div class="layui-input-inline" style="width:70%">
    					<input type="file" id="upfile" name="file" class="layui-input"/>
    				</div>
	                </div> 
    			<div class="layui-form-item tc_btndiv">
    				<input type="hidden" value="0" id="customerfileid" name="fileid">
	            </div>
    		</form>
    	</div>
    </div>
    
    <!-- 联系记录弹窗 -->
    <div class="addlxjl">
    	<form class="layui-form" id="tjlxjlForm" action="">
	      <div class="layui-form-item address" style="margin-top:10px">
	            <label class="layui-form-label">联系人： </label>
	            <div class="layui-input-block" style="width:60%">
	                  <select name="contact" id="contact"  lay-filter="contact">
	                    	<option value="">请选择</option>
	                 </select>
	            </div>
	        </div>
		     <div class="layui-form-item layui-form-text">
			    <label class="layui-form-label"><i>*</i><span>备注：</span></label>
			    <div class="layui-input-block" style="width:60%">
			      <textarea id="remark" name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
			        <input name="id" id="jlid" type="hidden" value="0">
			    </div>
			 </div>
	    </form>
    </div>
    
    
    
    <!-- 预约记录弹窗 -->
    <div class="addyyjl">
    	<form action="" method="post" id="bookingform">
			<div class="TM-booking-to" style="padding:10px 20px;">
				<div class="layui-form-item">
					<label class="layui-form-label">预约时间：</label>
					<div class="layui-input-block" style="width:60%">
						<input type="text" name="stime" id="stime" placeholder="YYYY-MM-DD hh:mm:ss" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this, min: laydate.now(0), istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
	    			</div>
    			</div>
    			<div class="layui-form-item">
					<label class="layui-form-label">备注：</label>
				    <div class="layui-input-block" style="width:60%">
				      	<textarea name="remark" id="email-inner" placeholder="请输入内容" class="layui-textarea"></textarea>
				    </div>
			    </div>
				<!-- <textarea name="remark" id="email-inner" cols="60" rows="5" style="width: 606px;"></textarea> -->
				<!-- <div id="bookingbtndiv" style="text-align: center; margin-top: 10px;">
					<input type="button" value="保存" id="savebooking">
					<input type="button" value="取消" id="cancelbooking">
				</div> -->
			</div>
		</form>
    </div>
    
 <!-- B证查询弹窗 -->
    <div class="bzcxdiv hideadd ">
			<div class="TM-booking-to" style="padding:10px 20px;">
				 
				 <fieldset class="layui-elem-field">
				  <legend>A</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://www.ahgcjs.com.cn:3318/pub/query/person/personScoreList/CODE_INDEX_SAFTY_TYPE/1' target="_blank">安徽</a>
							 </div>
		    			</div> 
				  </div>
				</fieldset>
				
				 <fieldset class="layui-elem-field">
				  <legend>B</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								 <a href='http://www.bjjs.gov.cn/eportal/ui?pageId=308888' target="_blank">北京</a>
			    			</div>
		    			</div> 
				  </div>
				</fieldset>
				
				<fieldset class="layui-elem-field">
				  <legend>C</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://jzzb.cqjsxx.com/cq_aq/ReadOnly_Info/Person_2.aspx?CheckType=All' target="_blank">重庆</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://jzzb.cqjsxx.com/cq_aq/ForeDisplay/Affiche_Info/Affiche_Info.aspx?s=0' target="_blank">重庆</a>
							</div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>F</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://www.fjjsrckj.com/cert.aspx' target="_blank">福建</a>
							 </div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>G</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								 <a href='http://www.gdcic.net/KHGL/CertificateReport.aspx' target="_blank">广东</a>
			    			</div>
			    			<div class="layui-input-inline" style="width:20%">
							<a href='http://www.gsjs.gov.cn/index.aspx?tabid=0fc6ebc6-ccf8-4d6f-9dc0-caf99e7b2ea3' target="_blank">甘肃</a>
							</div>
							<div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://www.gdcic.net/khgl/ExamReportQuery.aspx' target="_blank">广东</a>
							</div>
		    			</div> 
		    			
		    			<div class="layui-form-item">
			    			<div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://jsjp.gzjs.gov.cn/jsgwjypx/' target="_blank">贵州</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://sys89.gxzjt.gov.cn:8080/RegisterUser/TrainManageMis/WebApply/SlExam/ExamTaskScore_List.aspx' target="_blank">广西</a>
							</div>
						</div>
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>H</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://www.hebjs.gov.cn/was5/web/search?channelid=293615' target="_blank">河北</a>
							</div>
			    			<div class="layui-input-inline" style="width:20%">
							<a href='http://app.hbcic.gov.cn/anquan/AQcheck.aspx' target="_blank">湖北</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://edu.hljjs.gov.cn/default.aspx' target="_blank">黑龙江</a>
							</div>
		    			</div> 
		    			<div class="layui-form-item">
			    			<div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://www.hngcjs.net/zxcx/zxcx_aqry.asp?rtype=B' target="_blank">河南</a>
							</div> 
							<div class="layui-input-inline" style="width:20%">
							<a href='http://qyryjg.hunanjz.com/public/ProfessionList.aspx?lb=slry' target="_blank">湖南</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://www.hnccp.net/ZSCX/slry.aspx' target="_blank">海南</a>
							</div>
		    			</div>
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>J</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://221.226.118.170:8080/abcCertInfo/queryAbcCert?menucode=0315' target="_blank">江苏</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://115.28.27.28:8021/' target="_blank">吉林</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://www.jxazjd.com/Operation.aspx?R=31' target="_blank">江西</a>
							</div>
		    			</div> 
		    			<div class="layui-form-item">
		    			
		    			</div>
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>L</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://jsaq.lnjst.gov.cn/querycard/threekindmanlist.aspx' target="_blank">辽宁</a>
							 </div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>N</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://mail.nmgjsw.gov.cn/website/main/Channel.aspx?fcol=101005' target="_blank">内蒙</a>
							 </div>
							 <div class="layui-input-inline" style="width:20%">
								<a href='http://www.nxajz.com.cn/SiteAcl.srv?id=152693' target="_blank">宁夏</a>
							  </div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>Q</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								<a href='http://jzsc.qhcin.gov.cn/' target="_blank">青海</a>
								</div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>S</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
								 <a href='http://ksjd.jsjtrc.com/ps.php' target="_blank">上海</a>
			    			</div>
			    			<div class="layui-input-inline" style="width:20%">
							<a href='http://www.lzjszj.com/SLRYGL_Home/home/default.aspx#' target="_blank">山东</a>
							</div> 
							<div class="layui-input-inline" style="width:20%">
							<a href='http://www.sxjs.gov.cn/onlineoffice/onlinesearch.action' target="_blank">山西</a>
							</div>
		    			</div> 
		    			<div class="layui-form-item">
			    			<div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://www.scjst.gov.cn:8081/QueryInfo/Person/PersonList.aspx?type=401' target="_blank">四川</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://124.115.170.171:7001/PDR/network/informationSearch/personSearch?&pageNumber=1' target="_blank">陕西</a>
							</div>
						</div>
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>T</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							<div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://218.69.33.151/EPR/Search/C_Common/P28/index.aspx' target="_blank">天津</a>
							</div> 
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>X</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://admin.xzcs.gov.cn/aspx/userinfo/CertifiedEngineers.aspx' target="_blank">西藏</a>
							</div>
							<div class="layui-input-inline" style="width:20%">
							<a href='http://jsy.xjjs.gov.cn/dataservice/query/staff/list' target="_blank">新疆</a>
							</div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>Y</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://www.ynjst.gov.cn/' target="_blank">云南</a>
							</div>
		    			</div> 
				  </div>
				</fieldset>
				<fieldset class="layui-elem-field">
				  <legend>Z</legend>
				  <div class="layui-field-box">
				  		<div class="layui-form-item">
							 <div class="layui-input-inline" style="width:20%;margin-left:20px;">
							<a href='http://220.189.211.50:810/manageweb/WebQuicksearch.action' target="_blank">浙江</a>
							</div>
		    			</div> 
				  </div>
				</fieldset>
				  
			</div>
		 
    </div>
    
   
    
    
</div>

  <form action="http://jzsc.mohurd.gov.cn/dataservice/query/staff/list" method="post" id="zsxxcxform" target="_blank"> 
      	<input name="ry_name" value="" type="hidden" />
      	<input name="ry_type" value="" type="hidden" />
      	<input name="ry_reg_type" value="" type="hidden" />
      	
        <input name="reg_seal_code" value="" type="hidden"   />			
        <input name="ry_cardno" value="" type="hidden" />
        <input id="ry_qymc" name="ry_qymc" value="" type="hidden"  /> 
		<input type='hidden' name='complexname' value='${cuinfo.cname}'>
	 </form>
	 
	 <form action="http://jzsc.mohurd.gov.cn/dataservice/query/staff/list" method="post" id="zsxxcxoneform" target="_blank"> 
      	<input name="ry_name" value="" type="hidden" />
        <input name="reg_seal_code" value="" type="hidden"   />	
        	<input name="ry_type" value="" type="hidden" />
      	<input name="ry_reg_type" value="" type="hidden" />		
        <input name="ry_cardno" value="" type="hidden" />
        <input id="ry_qymc" name="ry_qymc" value="" type="hidden"  /> 
		<input type='hidden' name='complexname' value='${cuinfo.idcard}'>
	 </form>
	 
	 	 <form action="http://jzsc.mohurd.gov.cn/dataservice/query/staff/list" method="post" id="namecxoneform" target="_blank"> 
      	<input name="ry_name" value="" type="hidden" />
        <input name="reg_seal_code" value="" type="hidden"   />		
        	<input name="ry_type" value="" type="hidden" />
      	<input name="ry_reg_type" value="" type="hidden" />	
        <input name="ry_cardno" value="" type="hidden" />
        <input id="ry_qymc" name="ry_qymc" value="" type="hidden"  /> 
		<input type='hidden' name='complexname' value='${cuinfo.cname}'>
	 </form>
	 
	 
	 <form  action="http://www.ahjst.gov.cn/ahzjt_front/searchpage/Matter/Personnel/Personnel_list_Main.html?code="  id="anchaform"   method="get"  target="_blank">
				  <input name="staff_name" type="hidden"  value="">
				  <input name="comp_name" type="hidden"  value="">
				 <input name="staff_idcard" type="hidden"  value="${cuinfo.idcard}">
				 <input name="scomp_post_name" type="hidden"  value="">
				 <input name="scomp_prof_name" type="hidden"  value="">  
	 </form>
	 

<div class="Mask ZZmask"></div>



<!-- 添加证书弹框 -->
	<div id="TM-layui-zhengshu" style="display: none;">
		<div class="tab-condition" style="margin-left: 35px;">
			<form class="layui-form clefix" action="" id="zssearch">
				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="text" name="keyWord" id="zskeyword"
							autocomplete="off" placeholder="请输入关键字" class="layui-input">
						 <input type="hidden" id="skpg" name="skipToPage" value="1">
					</div>
				</div>
				<div class="layui-form-item">
				<div class="layui-input-inline ">
					 <select name="uid"  id="seluid"  lay-search>
                    	<option value="">请选择用户</option>
                    	<option value="-1" <c:if test="${ -1 == pager.params.uid }">selected</c:if> >全部</option>
                    	<c:forEach var="nameobj" items="${userlist}">
                    		<option value="${nameobj.uid}" <c:if test="${ nameobj.uid == pager.params.uid }">selected</c:if> >${nameobj.name}</option>
                    	</c:forEach>
                    </select>
				</div> 
				</div>  
				<div class="layui-form-item">
		            <div class="layui-input-inline">
		                   <select name="source" id="source">
		                       <option value="">客户来源</option>
		                       <option value="0" >全部</option>
		                       <dic:cf type="2" name="customer_source" value=""/>
		                   </select>
		             </div>
			  </div> 
				<div class="layui-form-item">
					<button class="layui-btn TM-btn-search zssearchbtn" type="button">
						<i class="layui-icon layui-unselect layui-tab-close">&#xe615;</i>搜索
					</button>
					<button class="layui-btn TM-btn-search zscleanbtn" type="button">
						<i class="layui-icon layui-unselect layui-tab-close">&#xe615;</i>清空
					</button>
				</div>
			</form>
		</div>
		<div class="entering">
			<table class="site-table table-hover TM-table3"
				style="width: 99%; margin: 0 auto;">
				<thead>
					<tr>
						<th style="width: 122px;">入职公司</th>
						<th style="width: 171px;">地区</th>
						<th style="width: 172px;">所属人</th>
						<th style="width: 101px;">操作</th>
					</tr>
				</thead>
				<tbody class="tb_customerzs">
				</tbody>
			</table>
			<div class="admin-table-page">
				<div id="zspage" class="page zspage"></div>
			</div>
		</div>
	</div>
	
	<script id="zslb" type="text/html"> 
{{#  layui.each(d.resultList, function(index, item){ }} 
<tr  >
		                <td>{{item.cname}}</td>
						<td>{{# if(item.address==null){ }} {{#  } else { }}  {{item.address}} {{#  } }}</td>
		                <td>{{item.createusersname}} </td>
		                <td>
							{{# if(item.quid==null){ }} 
  								<button class="layui-btn  layui-btn-small addzs" data="{'id':'{{item.id}}','uid':'{{item.uid}}','name':'{{item.cname}}','createname':'{{item.createusersname}}','advancemoney':'{{item.advancemoney}}'}"   type="button">加入<i class="layui-icon"></i></button>
							{{#  } else { }} 
	 						    <button class="layui-btn layui-btn-disabled layui-btn-small "   type="button">已聘用<i class="layui-icon"></i></button>
							 {{#  } }} 
		                </td>
	               	</tr>
 
{{#  }); }}  
</script>

<script type="text/javascript" src="<%=basePath%>js/customerselectlist.js?v=<%=callcenterstate%>35"></script>

<script id="dyjl" type="text/html"> 
{{#  layui.each(d.list, function(index, item){ }} 
       <tr>
	      <td>{{item.uname}}</td>
	      <td>{{item.updatedate.substring(0,10)}} {{item.updatedate.substring(10,16)}}</td>
	      <td>{{#  if(item.remark!=null){ }} {{item.remark}}  {{#  } }} </td>
        </tr> 
{{#  }); }} 
</script>
<script>


(function($,window,document,undefined){ //用一个自调用匿名函数把插架代码包裹起来，防止代码污染
    $.fn.mySelect = function (options) {
        var defaults = {          //defaults 使我们设置的默认参数。
            Event : "click",      //触发响应事件
            msg : "Holle word!"   //显示内容
        };

        var inputobj = $("#"+options.inputid);
        var inputobjvalue = inputobj.val();
        var inpuarray = inputobjvalue.split(",");
        console.log(inpuarray) 
        var options = $.extend(defaults, options);    //将传入参数和默认参数合并
      
        var $this = $(this);      //当然响应事件对象
        // $this.live(options.Event, function (e) {   //功能代码部分，绑定事件
        //     alert(options.msg);
        // });
       //生成option-item并追加展示
       var checkedArr = [];
 			var checkedIDArr = [];
        var html = '';
 		html += '<div class="select-picker-search">';
 		html += '<div class="select-picker-search-checked">请选择</div>';
 		html += '</div>';
 		html += '<div class="select-picker-options-wrp">';
 		//html += '<div class="select-picker-options-serch">';
 		//html += '<input type="text" placeholder="">';
 		//html += '</div>';
 		html += '<div class="select-picker-options-list">';
 		$this.find("option").each(function(){ 
 			let _this = $(this);
 			html += '<div class="select-picker-options-list-item" dataid="'+_this.attr("value")+'">';

			if(inpuarray!=null&&inpuarray.length>0){
                var chk ="duihao-nocheck";
	            for(var i=0;i<inpuarray.length;i++){
					if(inpuarray[i]==_this.attr("value")){
						chk="duihao-checked";
						checkedArr.push($.trim(_this.text()))
						break;
				    }
                } 
            	html += '<b class="duihao '+chk+'"></b>';
			}else{
				html += '<b class="duihao duihao-nocheck"></b>';
			}
 			
 		
 			html += '<span>'+_this.text()+'</span>';
 			html += '</div>';
 		})
 		html += '</div>';
 		html += '</div>'; 
	 	$this.append(html);

	 	if (checkedArr.length > 0) {
		    $this.find('.select-picker-search-checked').text(checkedArr.join(','));
		   // $this.find('.select-picker-search-checked').text(checkedIDArr.join(','));
		    // $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
		} else {
		    $this.find('.select-picker-search-checked').text('请选择').css('color', '#757575');
		}
	 	
	 	// 下拉显示隐藏
	 	$this.on('click',".select-picker-search", function (e) {   //功能代码部分，绑定事件
           	$(this).next('.select-picker-options-wrp').toggle();
	 	 	$(this).next('.select-picker-options-wrp').find('.select-picker-options-serch input').focus();
        }); 
        // 点击选中或不选
 		$this.on('click',".select-picker-options-list-item",function(){ 
 			let _this = $(this);
 			checkedArr = [];
  			checkedIDArr = [];
 			if(_this.find('.duihao-nocheck').length > 0){
				_this.find('.duihao').removeClass('duihao-nocheck').addClass('duihao-checked');
 			}else{
				_this.find('.duihao').addClass('duihao-nocheck').removeClass('duihao-checked');
 			}
 			// 循环遍历options中选中的项添加到选项栏中
 		
			$this.find(".select-picker-options-list-item").each(function(){ 
				let _this = $(this); 
				if(_this.find('.duihao-checked').length > 0){ 
					checkedArr.push($.trim(_this.text()))
					 
					checkedIDArr.push($.trim(_this.attr("dataid")))
				}
			})
			if (checkedArr.length > 0) {
			    $this.find('.select-picker-search-checked').text(checkedArr.join(','));
			    inputobj.val(checkedIDArr.join(',')+",");
			   // $this.find('.select-picker-search-checked').text(checkedIDArr.join(','));
			    // $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
			} else {
				 inputobj.val("");
			    $this.find('.select-picker-search-checked').text('请选择').css('color', '#757575');
			}
 		})
 		// 前端实现下拉搜索 
 		$this.on('keyup',".select-picker-options-serch input",function(){  
 			var text = $(this).val();
 			var html = '';
 			$this.find("option").each(function(){ 
	 			let _this = $(this);
	 			if(_this.text().indexOf(text) != -1){
		 			html += '<div class="select-picker-options-list-item">';
		 			html += '<b class="duihao duihao-nocheck"></b>';
		 			html += '<span>'+_this.text()+'</span>';
		 			html += '</div>';
	 			}
	 		})
	 		if(html == ''){
	 			html += '<p style="text-align:center;">没有相关内容</p>';
	 		}
	 		$this.find(".select-picker-options-list").html('').append(html);
 		})
    }
    // 点击document任意地方 下拉消失
  $(document).click(function (event) {
    var _con = $('.select-picker-options-wrp'); // 设置目标区域
    var _con2 = $('.select-picker-search-checked'); // 设置目标区域
    if (!_con2.is(event.target) && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1 
      $('.select-picker-options-wrp').hide(); //淡出消失
    }
  });
})(jQuery,window,document); 


    layui.use(['laypage','laytpl','form','laydate'], function() {
        var $ = layui.jquery,
                layer = layui.layer,
                laytpl = layui.laytpl,
                laypage = layui.laypage;
        var form = layui.form();
    	 
     /*    var jobselobj=   $("#zizhiType").jobsel({
           	'inputName' : "category"
           });
      
      jobselobj.init();  
         */


         $("#demo1").mySelect({inputid:"xzuser"});
         
        $("#callphone").on("click",function(){
        	
        	if(callcenterstate==0){
        		layer.msg('请开通轻客呼叫中心' );
        		return false;
			}
        	
     	      var phone =$("#tel").val();
     	     var cusid =$("#id").val();
     	     $(".lxjladd").click();
     	      
     	 	layer.confirm('请确认电话：'+phone, {
       		  btn: ['确认拨打'] //可以无限个按钮
       	      ,shade: 0
       		  ,btn1: function(index, layero){
       			 	 layer.msg('正在拨号，请勿关闭界面', {icon: 16},function(){
	       			 layer.confirm('通话中：'+phone, {
	       				   anim:2,
	       				   offset: 't',
	       	        		  btn: [ '挂断'] 
	       	        	      ,shade: 0
	       	        		  ,btn1: function(index, layero){
	       	        			  layer.msg('正在挂断电话...', {icon: 16},function(){});
	       	        			 /*  var status =  localStorage.getItem('workbenchSdkStatus');
	       	        			  if(status>=8&&status<=12){
	       	        				    localStorage.setItem('workbenchSdkHangup', Math.random())
	       	        			  }   */
	       	        			$.ajax({
        	               			type : "get",
        	               			url : "http://127.0.0.1:3366/callhang?callback=cb_callout",
        	               			async:false,
        	               			dataType : "html",
        	               			success : function(data){
        	               				result = data;
        	               				//eval(result); 
        	               			 
        	               			}
        	               		}); 
	       	        		  }
	       			   }); 
	       		   }); 
       			  var telurl ="http://127.0.0.1:3366/callout?phone="+phone+"&callback=cb_callout&recordId="+cusid+"-"+currentuserid;;
      			  $.ajax({
              			type : "get",
              			url : telurl,
              			async:false,
              			dataType : "html",
              			success : function(data){
              				result = data;
              			//	eval(result); 
                  }});
	       	      /* var status =  localStorage.getItem('workbenchSdkStatus');
	   			  if(status==3||status==4||status==5){
	   				  	  var value = {'callee':phone, 'random': Math.random()};
			        	      localStorage.setItem('workbenchSdkCall', JSON.stringify(value)); 
	   			  }   */
       		  },
     	 	cancel: function(index, layero){ 
     	 	    layer.closeAll()
     	 	}    
       		});  
        }) 
        
  $("#zsxxcx").on("click",function(){
    	   $("#zsxxcxform").submit();
       }) 
       
        $(".gsdcx").on("click",function(){
    	  var url = 'https://www.baidu.com/s?wd=${ccon.tel}';
    	  layer.open({
    		   type: 2, 
    		   content: url  ,
    		   area:['50%','90%'],
    		   btnAlign: 'c'
    	   });
       }) 
       
        $(".sllgsdcx").on("click",function(){
    	  var url = 'https://www.so.com/s?ie=utf-8&fr=none&src=360sou_newhome&q=${ccon.tel}';
    	  layer.open({
    		   type: 2, 
    		   content: url  ,
    		   area:['50%','90%'],
    		   btnAlign: 'c'
    	   });
       }) 
       
      
       
        $("#zsxxcxone").on("click",function(){
    	   $("#zsxxcxoneform").submit();
       }) 
        $("#namecxone").on("click",function(){
    	   $("#namecxoneform").submit();
       }) 
       $("#ancha").on("click",function(){
    	   $("#anchaform").submit();
       }) 
       
        $("#bzcxone").on("click",function(){
        	layer.open({
        		type:1,
	           	btnAlign:'c',
	           	shadeClose:false,
	           	shade:0,
		  		title:"B证查询",
		  		zIndex: 999,
		  		content: $(".bzcxdiv"),
		  		area:['300px','90%'],
		  		maxWidth:800  		
        	});
       }) 
       
       
       
       //查资格证
       $(".zgzcx").on("click",function(){ 

           var codes= [{code:"110000",value:"京"},
            {code:"120000",value:"津"},
            {code:"130000",value:"冀"},
            {code:"140000",value:"晋"},
            {code:"150000",value:"蒙"},
            {code:"210000",value:"辽"},
            {code:"220000",value:"吉"},
            {code:"230000",value:"黑"},
            {code:"310000",value:"沪"},
            {code:"320000",value:"苏"},
            {code:"330000",value:"浙"},
            {code:"340000",value:"皖"},
            {code:"350000",value:"闽"},
            {code:"360000",value:"赣"},
            {code:"370000",value:"鲁"},
            {code:"410000",value:"豫"},
            {code:"420000",value:"鄂"},
            {code:"430000",value:"湘"},
            {code:"440000",value:"粤"},
            {code:"450000",value:"桂"},
            {code:"460000",value:"琼"},
            {code:"500000",value:"渝"},
            {code:"510000",value:"川"},
            {code:"520000",value:"贵"},
            {code:"530000",value:"云"},
            {code:"540000",value:"藏"},
            {code:"610000",value:"陕"},
            {code:"620000",value:"甘"},
            {code:"630000",value:"青"},
            {code:"640000",value:"宁"},
            {code:"650000",value:"新"}]
     	   var val = $("#address").val();
     	   var url ="http://jzsgl.coc.gov.cn/archisearch/";
     	   if(val.length>2){
     		   var sf = val.substring(0,1);
     		   var code = "";
     		   for(var i=0;i<codes.length;i++){
     			 
     			   var cvalue = codes[i].value;
     			   if(cvalue==sf){
     				   code = codes[i].code;
     			   }
     			
     		   }
     		   
     		   var leval = val.substring(1,2);
     		   if(leval=="1"){
     			  url = "http://jzsgl.coc.gov.cn/archisearch/cxyjjzs/rylist.aspx?sjbm="+code+"&qymc=&xm=&zclb=00&zczy=全部&zczsbh=&zch="+val+"&zyzgzsbh=";
     		   }else if(leval=="2"){
     			  url = "http://jzsgl.coc.gov.cn/archisearch/cxejjzs/rylist.aspx?sjbm="+code+"&qymc=&xm=&zclb=00&zczy=全部&zczsbh=&zch="+val+"&zyzgzsbh="; 
     		   }
     	   } 
     	   
     	   layer.open({
     		   type: 2, 
     		   content: url  ,
     		   area:['95%','95%'],
     		   btnAlign: 'c',
     	       btn: ['去登录'],
     	       yes: function(index, layero){
     	    	   window.open("http://jzsgl.coc.gov.cn/archi/group/personLogin.aspx",'a');
     	       }
     	   });
    	
    	   
       }) 
       
       
      	var vother=0;
		form.on('radio(filter)', function(data){
				if(data.value=="其他"){
					vother=1;
					$("#fsremarks").val("");
					$("#otherremarks").show();
					 
				}else{
					vother=0;
					$("#otherremarks").val("");
					$("#otherremarks").hide();
					form.render();
					
					$("#fsremarks").val(data.value);
				}  
			 // console.log(data.elem); //得到checkbox原始DOM对象
			  //console.log(data.elem.checked); //是否被选中，true或者false
			 // console.log(data.value); //复选框value值，也可以通过data.elem.value得到
			 // console.log(data.othis); //得到美化后的DOM对象
		});   
       
 /*      var jobselobj=   $("#zizhiType").jobsel({
           	'inputName' : "categorys"
           });
      
      jobselobj.init();
      
      var jobselobj1=   $("#zizhiType1").jobsel({
         	'inputName' : "category"
         }); 
    
    jobselobj1.init();*/
      
  	//分页按钮
  	if('${customerid}'!=null&&'${customerid}'.length>0){
  		laypage({
            cont: 'page',
            curr:  '${lxpager.pageNo}'
            ,pages: '${lxpager.totalPages}' //总页数
            ,
            groups: 5 //连续显示分页数
            ,
            skip: true,
            jump: function(obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                if(!first) { 
                	$.ajax({
              		type : "post",
              		url : "/customer/customerdynamic",
              		async : false,
              		data : {skipToPage : curr,cusid : '${customerid}'},
              		dataType : "json",
              		success : function(data){
              			 var getTpl = $("#dyjl").html();
  				 laytpl(getTpl).render(data, function(html){
  					  
  					 $(".lxjlbody").html(html);
  					  //view.innerHTML = html;
  					});
              			 
              		}
              	});
                	 
                }
            }
        }); 
      
  	}
    
	  //证书报价弹窗
		$("#zsbj").on('click',function(){
			/* layer.open({
				type: 2
				,content: '/offer/offerlist'
				,btnAlign: 'c' //按钮居中
				,shadeClose:true
				,title:'证书报价 '
				,area:['90%','90%']
				,maxWidth:800
			}); */
			
			   layer.open({
	     		   type: 2, 
	     		   content: "http://www.360guakao.net/t0a0x0/1.html"  ,
	     		   area:['90%','90%'],
	     		   btnAlign: 'c' 
	     	   });
		});
      
	   var id = $("#province").val();
	   if(id>0){
		   var html = city.getCityByPid(id);
			   $("#city").html(html);
			   var cv =  $("#city").attr("value"); 
			   if(cv>0){
				 $("#city").val(cv); 
			   }
			   //更新渲染  
	    	   form.render(); 
	   }
      
        //省份城市选择
    	form.on('select(province)', function(data){
    		var id = $("#province").val();
    		var html = city.getCityByPid(id);
			$("#city").html(html);
			//更新渲染
	    	form.render('select');
    	});
        
        //监听提交
        form.on('submit(back)', function() {
        	var type = $("#type").val();
        	var state = $("#states").val();
        	var url = "/customer/entman/ty"+type+"_st"+state;
        	window.location.href = url;
         });
        
        
        //验证号码是否已经存在
    	jQuery.validator.addMethod("checktel", function(value,element) {
			var iszj = $('input[name="iszj"]:checked').val();
			if(iszj ==1){
				 return true;
		    }
    		//alert();
        	var flag = true;
        	value = $.trim(value);
        	var id = $("#id").val();
        	if (value.length > 0) {
        		$.ajax({
            		type : "post",
            		url : "/customer/chaecktelisexist",
            		async : false,
            		data : {phone : value,id : id},
            		dataType : "json",
            		success : function(data){
            			if (id == '' || id == null) {
            				//说明是新增
            				if (data > 0) {
            					flag = false;
            				} else {
            					flag = true;
            				}
            			} else {
            				//说明是修改
            				if (data > 1) {
            					flag = false;
            				}
            			}
            		}
            	});
        	}
            return flag;
        }, "号码已存在");
        
    	//验证框架，验证手机号码是否正确
    	jQuery.validator.addMethod("checkphone",function(value,element) {
    		var flag = true;
    		var phone = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
    		flag = phone.test(value);
    		 
    		return flag;
    	}, "手机号码格式不正确");
        
        //录入客户验证
		$("#enterform").validate({
			
	    	rules: {
	    		cname : {
	    			required:true,
	    			rangelength:[2,20] 
	    		},
	    		/*idcard:{
	    			required:true	
	    		},
	                 endtime:{
	    			required:true	
	    		}, */
	    		/* address : {
	    			required:true
		    	}, */
	    		city: {
	    			required:true
	    		},
	    		province: {
	    			required:true
	    		},
	    		createdate: {
	    			required:true
	    		},
	    		state: {
	    			required:true
	    		},
	    		phone: {
	    			checktel:true 
	    		},
	    		webchart:{
	    			required:true
			    	},
	    		tel: {
	    			required:true, 
	    			checktel:true
	    		},technicalpost:{
	    			required:true
	    		}/* ,
	    		zizhiType1: {
	    			required:true,
	    		}, */
	    	},
	    	messages: {
	    		cname : {
	    			required:"请输入客户姓名",
	    			rangelength:"长度在2-20之间", 
	    		},
	    		/*idcard:{
	    			required:"请输入客户身份证",
	    		},
			   endtime:{
	    			required:"请输入到期时间",
	    		}, 
	    		address : {
	    			required:"请输入地址",
		    	},*/
	    		city: {
	    			required:"请选择城市",
	    		},
	    		province: {
	    			required:"请选择省份",
	    		},
	    		createdate: {
	    			required:"请选择创建时间",
	    		},
	    		state: {
	    			required:"请选择所在库",
	    		},
	    		phone: {
	    			checktel:"请填写正确的手机号码" 
	    		},
	    		webchart:{
	    			required:"请填写微信号",
			     },
	    		tel: {
	    			required:"请输入联系号码",
	    			checktel:"号码已存在"
	    		},technicalpost:{
	    			required:"请输入证书及专业"
	    		}
	    		/* ,
	    		zizhiType1: {
	    			required:"请选择证书类型",
	    		}, */
	    	},
	    	errorPlacement: function(error, element) {
				layer.tips(error.text(), element, {
					tips: [2,tipColor],
	     		 tipsMore: true
	     		});
	   		}, 
	   	 submitHandler: function(form) {
	   		 
	   		var $form = $(form),
            data = $form.serialize();
	   		$.ajax({
	   			 type : "post",
	   			 url : "/customer/savecustomer",
	   			 data : data,
	   			 dataType : "json",
	   			 async : false,
	   			 success : function(data){
	   				 if (data == 0) {
	   					layer.msg("录入失败");
	   				 } else {
	   					if(data <0){
							layer.msg("已达到资源上限，请联系管理员"); 
							return false;
						} 
	   					layer.msg("录入成功");
	   					window.location.href = "/customer/updatecustomer"+data;
					}
	   			 }
	   		 });
	      }
	    });
        
        
        
		//添加文件
        $(document).on("click",".addwj",function(){
        	layer.open({
        		type:1,
	   		  	btn:['确定','取消'],
	           	btnAlign:'c',
	           	shadeClose:true,
		  		title:"添加文件",
		  		zIndex: 999,
		  		content: $(".addwjtc"),
		  		area:['50%','350px'],
		  		maxWidth:800,
		  		yes: function(layero, index){
		        	var file = $("#upfile").val();
				var remark = $("#fsremarks").val();
		        	

	        		var otherremark= $("#otherremarks").val();
					if(vother==1&&otherremark.length<1){
						layer.tips("请输入文件描述", $("#others"), {
		 					tips: [3,tipColor],
		 	     		 tipsMore: true
		 	     		});
						return false; 
					}else  if(vother==0&&remark.length<1){
						layer.tips("请选择文件内容", $("#others"), {
		 					tips: [3,tipColor],
		 	     		 tipsMore: true
		 	     		});
						return false; 
					}else if (file == null || file == ""){
		        		
		        		layer.tips("请选择您要上传的文件", $("#upfile"), {
		 					tips: [3,tipColor],
		 	     		 tipsMore: true
		 	     		});
		        		//layer.msg("请选择您要上传的文件",{icon : 2});
		        		return false;
		        	} else {
		        		 $("#fsremarks").val(remark+otherremark);
		        		var infoid = $("#id").val();
		        		var url = "/customer/uploadCustomerfilei"+infoid+"_t"+0;
		        		$("#tc_customerfileform").attr("action",url);
		        		layer.msg("文件上传中",function(){
		        			$("#tc_customerfileform").submit();
		        		})
		        	}

		  		}   		
        	});
        });
        
      	

      //点击下载
      	$(".downloadcunstomerfilesbtn").on("click",function(){
      		var id = $(this).attr("data");
      		//window.location.href = "/file/"+id;
      		window.open("/file/"+id,'target','');
      	});

    	//点击下载
      	$(".downloadcunstomerfilesbtntwo").on("click",function(){
      		var id = $(this).attr("data");
      		//window.location.href = "/viewfile/"+id;
      		window.open("/viewfile/"+id,'target','');
      	});
      	
      	
      	//点击删除
        $(".detelecustomerfilebtn").on("click",function(){
      		
      		var id = $(this).attr("data");
      		
      		layer.confirm('是否确认删除', {
      		  	btn: ['确认','取消'] //按钮
      		}, function(){
      			$.ajax({
          			type : "post",
          			url : "/customer/deletefileinfo",
          			data : {id:id},
          			dataType : "json",
          			success : function(data){
          				layer.msg("删除成功",function(){
          					window.location.reload();
          				});
          			}
          		})
      		}, function(){
      			layer.closeAll();
      		});
      		
      	});  
      	
        //添加需求
        $(document).on("click",".addxq",function(){
        	$("#categoryid").val("");
        	document.getElementById("tc_savecustomercategoryform").reset();
        	layer.open({
        		type:1,
	   		  	btn:['确定','取消'],
	           	btnAlign:'c',
	           	shadeClose:true,
		  		title:"添加需求信息",
		  		zIndex: 999,
		  		content: $(".addxqtc"),
		  		area:['70%','70%'],
		  		maxWidth:800,
		  		yes: function(layero, index){
		  			$("#tc_savecustomercategoryform").submit();
		  		}   		
        	});
        });
      
        //点击保存需求信息
        $("#tc_savecustomercategoryform").validate({
        	rules: {
        		zizhiType : {
	    			required:true,
	    		},
	    		categoryname:{
	    			required:true
	    		},
	    		count : {
	    			digits:true,
	    			required:true,
	    		},
	    		endtime : {
	    			required:true,
	    		},
	    		types : {
	    			required:true,
	    		},
	    		paperspurpose : {
	    			required:true,
	    		},
	    	},
	    	messages: {
	    		zizhiType : {
	    			required:"请选择证书",
	    		},
	    		categoryname : {
	    			required:"请输入类型"
	    		},
	    		count : {
	    			digits:"请输入正确的数量",
	    			required:"请输入数量",
	    		},
	    		endtime : {
	    			required:"请选择结束时间",
	    		},
	    		types : {
	    			required:"请选择性质",
	    		},
	    		paperspurpose : {
	    			required:"请选择用途",
	    		},
	    	},
	    	errorPlacement: function(error, element) {
				layer.tips(error.text(), element, {
					tips: [2,tipColor],
	     		 tipsMore: true
	     		});
	   		}, 
	   	 submitHandler: function(form) {
	   		var ctname =$("#zizhiType").val(); 
	   		var data = $("#tc_savecustomercategoryform").serialize();
	   		var categoryid = $("#categoryid").val();
		 	$.ajax({
		 		type : "post",
		 		url : "/customer/savecustomercategory",
		 		data : data,
		 		dataType : "json",
		 		async : false,
		 		contentType: "application/x-www-form-urlencoded; charset=utf-8", 
		 		success : function(data){
		 			
		 			if(data['id']!=null){
		 				layer.msg("添加成功",{icon: 1},function(){
    						window.location.reload();
    					});
		 			}else{
		 				layer.msg("添加失败",{icon: 0},function(){
    						window.location.reload();
    					});
		 			}
		 			return  false;
		 			if (categoryid != null && categoryid > 0 ) {
		 				//修改
		 				var html = $(".catetr"+categoryid).html();
		 				html += "<tr class='catetr"+ data["id"] +"' data='"+ data["id"] +"'>"
	                	+"<td>"+ ctname +"</td>"
	                	+"<td>"+ data["count"] +"</td>"
	                	+"<td>"+ data["type"] +"</td>"
	                	+"<td>"+ data["paperspurpose"] +"</td>"
	                	+"<td>"+ data["endtime"] +"</td>"
	                	+"<td>"+ data["remark"] +"</td>"
	                	+"<td>"
	                	//+"<button class='layui-btn layui-btn-primary layui-btn-small updatecustomercategory' type='button'>修改<i class='layui-icon'></i></button>"
	                	+"<button class='layui-btn layui-btn-primary layui-btn-small deletecategory' type='button'>删除<i class='layui-icon'></i></button>"
	                	+"</td>"
	                	+"</tr>";
	                	$(".catetr"+categoryid).html(html);
		 			} else {
		 				//新增
		 				var html = $(".tb_customercategory").html();
			 			html += "<tr class='catetr"+ data["id"] +"' data='"+ data["id"] +"'>"
			                	+"<td>"+ ctname +"</td>"
			                	+"<td>"+ data["count"] +"</td>"
			                	+"<td>"+ data["type"] +"</td>"
			                	+"<td>"+ data["paperspurpose"] +"</td>"
			                	+"<td>"+ data["endtime"] +"</td>"
			                	+"<td>"+ data["remark"] +"</td>"
			                	+"<td>"
			                	//+"<button class='layui-btn layui-btn-primary layui-btn-small updatecustomercategory' type='button'>修改<i class='layui-icon'></i></button>"
			                	+"<button class='layui-btn layui-btn-primary layui-btn-small deletecategory' type='button'>删除<i class='layui-icon'></i></button>"
			                	+"</td>"
			                	+"</tr>";
			            $(".tb_customercategory").html(html);
		 			}
		            layer.closeAll();
		 		}
		 	});
	      }
        	
        });
      	
      //点击弹出联系记录
      	$(".lxjladd").on("click",function(){
      		var cid = $("#id").val();
      		$.ajax({
 		 		type : "post",
 		 		url : "/customer/customerinfoajax",
 		 		data : {id:cid},
 		 		dataType : "json",
 		 		async : false,
 		 		success : function(data){
 		 			var html ="";
 		 		    var contacts =	data.contactsItem;
 		 		    var cname = data.cname; 
 		 		    if(contacts!=null&&contacts.length>0){
 		 		    	for(var i =0;i<contacts.length;i++){
 		 		    		 html+="<option value='"+contacts[i].id+"'>"+contacts[i].name+"(电话："+contacts[i].phone+")</option>";
 		 		    	} 
 		 		    	$("#contact").html(html);
 		 		    }else{
 		 		    	$("#contact").html("<option value=''>请选择联系人</option>");
 		 		    }
 		 			form.render(); 
 		 			 layer.open({
	                       type:1,
	                       content:$('.addlxjl'),
	                       btn:['确定','取消'],
	                       btnAlign:'c',
	                       shadeClose:true,
	                       title:cname+'添加联系记录',
	                       area:['600px','300px'],
	                       maxWidth:800,
	                       yes: function(layero, index){
		                   		var ccuid = $("#contact").val();
		                       	var remark = $.trim($("#remark").val());
		                       	var cusid = $("#id").val();
		                       	var url = "/customer/updatecustomer"+cusid;
		                       	if (remark == null || remark.length < 1) {
		                       		layer.msg("请输入联系记录");
		                       		return false;
		                       	}
		                       	$.ajax({
		                       		type : "post",
		                       		url : "/customer/addcontactsdynamicinfo",
		                       		data : {ccuid:ccuid,remark:remark,cusid:cusid},
		                       		dataType : "json",
		                       		success : function(data){
		                       			if (data == 1) {
		                       				layer.msg("添加联系记录成功",{time : 700},function(){
		                       					window.location.href=url;
		                       				});
		                       			} else {
		                       				layer.msg("添加联系记录失败",{time : 700},function(){
		                       					window.location.href=url;
		                       				});
		                       			}
		                       		}
		                       	});
	                       }
 	                 });
 		 		}
 		 	});
      	});
      
      //删除需求
      	$(document).on("click",".deletecategory",function(){
      		var ids = $(this).parent().parent().attr("data");
      		var cusid = $("#id").val();
      		
      		layer.confirm('是否确认删除', {
      		  	btn: ['确认','取消'] //按钮
      		}, function(){
      			$.ajax({
          			type : "post",
          			url : "/customer/deletecustomercategorybyid",
          			data : {id:ids,cusid:cusid},
          			dataType : "json",
          			success : function(data){
          				layer.msg("证书删除成功",{time:700},function(){
    						window.location.reload();
    					});
          			}
          		});
      		}, function(){
      			layer.closeAll();
      		});
      	});
      
      //点击修改categorys
        $(document).on("click",".updatecustomercategory",function(){
        	var ids = $(this).parent().parent().attr("data");
        	$.ajax({
        		type: "post",
        		url: "/customer/getcustomercategory",
        		data: {ids:ids},
        		dataType: "json",
        		success:function(data){
        			$("#categorys").val(data["category"]);
                	$("#types").val(data["type"]);
                	$("#paperspurpose").val(data["paperspurpose"]);
                	$("#remarks").val(data["remark"]);
                	$("#categoryid").val(ids);
                	jobselobj.selData();
                	form.render();
                	layer.open({
              		  	type:1,
        		  		title:"修改证书信息",
        		  		zIndex: 999,
        		  		btn:['确定','取消'],
        	           	btnAlign:'c',
        		  		shadeClose:true,
        		  		content: $(".addxqtc"),
        		  		area:['40%','50%'],
        		  		maxWidth:800,
        		  		yes: function(layero, index){
        		  			$("#tc_savecustomercategoryform").submit();
        		  		}
              		});
        		}
        	})
        });
      
      	//点击弹出预约记录
      	$(".yyjladd").on("click",function(){
      		layer.open({
	   		  	type:1,
	   		  	btn:['确定','取消'],
	           	btnAlign:'c',
	           	shadeClose:true,
		  		title:"添加预约",
		  		zIndex: 999,
		  		content: $(".addyyjl"),
		  		area:['30%','350px'],
		  		maxWidth:800,
		  		yes: function(layero, index){
		  			
		  			var stime = $("#stime").val();
					var remark = $("#email-inner").val();
					var value = $("#id").val();
					var url = "/customer/updatecustomer"+value;
					$.ajax({
						type : "post",
						url : "/customer/bookingcontactsdynamicinfo",
						data : {stime:stime,remark:remark,value:value},
						dataType : "json",
						success : function(data){
							if (data == 0) {
								layer.msg("预约失败，请重试",{time : 700},function(){
									layer.closeAll();
								});
							} else {
								layer.msg("预约成功",{time : 700},function(){
									window.location.href=url;
								});
							}
						}
					});
               }
      		});
      	});
    });
    
  
</script>
</body>

 
</html>